<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Phone{
            //构造
            constructor(brand, price){
                this.brand = brand
                this.price = price
            }

            //父类的成员属性
            call(){
                console.log("我可以打电话");
            }
        }

        //声明子类
        class SmartPhone extends Phone{
            //构造方法
            constructor(brand, price, color, size){
                super(brand, price)
                this.color = color
                this.size = size
            }

            //添加子类中独有的方法
            photo(){
                console.log("拍照");
            }
            playgame(){
                console.log("打游戏");
            }
            call(){

                console.log("我可以进行视频通话");
            }
        }
        //实例化
        const xiaomi = new SmartPhone('小米', 799, '黑色', '4.7inch')
        console.log(xiaomi);
        //子类不能直接调用父类的同名方法
        xiaomi.call()
        xiaomi.photo()
        xiaomi.playGame()
    </script>
</body>
</html>